//
// Created by taojiaheng on 2020/6/10.
//

#include "TCP.h"

TCP::TCP() {

}

TCP::~TCP() {

}

int TCP::input(BUFF *buff, Connection *client) {
    return buff->buff_len;
}

BUFF *TCP::decode(BUFF *_buff, Connection *client) {
    BUFF * temp_buff = new BUFF;
    temp_buff->buff = new char[_buff->buff_len];
    temp_buff->buff_len = _buff->buff_len;
    memcpy((void *)temp_buff->buff, (void *)_buff->buff, _buff->buff_len);
    return temp_buff;
}

BUFF *TCP::encode(BUFF *_buff, Connection *client) {
    BUFF * temp_buff = new BUFF;
    temp_buff->buff = new char[_buff->buff_len];
    temp_buff->buff_len = _buff->buff_len;
    memcpy((void *)temp_buff->buff, (void *)_buff->buff, _buff->buff_len);
    return temp_buff;
}

int TCP::handshake(BUFF *_buff, Connection *client) {
    return 0;
}
